package Hot100.twoSearch;

public class findMin {
    public static void main(String[] args) {
        int nums[] = {11,13,15,17};
        System.out.println(new findMin().findMin(nums));
    }
    public int findMin(int[] nums) {
        int low = 0,high = nums.length - 1;
        int min = Integer.MAX_VALUE;
        while (low <= high){
            int mid = (high - low) / 2 + low;
            //左半段有序
            if(nums[low] <= nums[mid]) {
                if(min > nums[low])
                    min = nums[low];
                low = mid + 1;
            }
            //右半段有序
            else {
                if(min > nums[mid])
                    min = nums[mid];
                high = mid - 1;
            }
        }
        return min;
    }
}
